<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let map = new Map([['name', 'zhangsan'], ['age', 19], ['gender', '男']])
    console.log(map.keys());  // {"name", "age", "gender"}
    console.log(map.values());  // {"zhangsan", 19, "男"}
    console.log(map.entries());  // {"name" => "zhangsan", "age" => 19, "gender" => "男"}
    // 通过上述方法，可以将  键/值/成员  展示，可以将其进行循环遍历操作了

    for (const key of map.keys()) {
      console.log(key);
    }
    for (const key of map.values()) {
      console.log(key);
    }
    for (const [key, value] of map.entries()) {
      console.log(key, value);
    }

    // map直接进行for循环
    map.forEach((value, key) => {
      console.log(value, key);
    })
  </script>
</body>

</html>